db2 參照完整性問題 (db2 referential integrity problem)


問題描述

db2 參照完整性問題 (db2 referential integrity problem)

Situation is pretty serious, we have a table in DB2 on AS400 which has defined foreign key to another table, so we are entering record which have regular ID of referenced table so when we enter SQL insert through front end tool everything went fine. 

Problem arises when this insert is to be done through java application which uses Spring Framework (only SQL Handler, web services...)  so things finish with PreparedStatement using jdbc drivers in jt400.jar. We got message "referential integrity check failed" what is - as we checked - impossible. 

Does anyoe have similar experiences? Should we upgrade JTOPEN library? Now there is actual version 6.5, we are using 6.3 in production and are affraid of negative effects of upgrading it to 6.5.

Forgot to mention, restarting Tomcat (app server) has no effect, but if I restart linux box (ubuntu 8.10) everything works fine. Connection to DB is being administered by JNDI. 


參考解法

方法 1:

Maybe you are inside a transaction and the data you are going to put is inconsistent, and then a rollback is performed, so you should not see anytinh wrong.

(by ante.saboATorras)

參考文件

  1. db2 referential integrity problem (CC BY-SA 3.0/4.0)

#referential-integrity #java #db2 #spring #jt400






相關問題

Jika saya memiliki batasan kunci asing dari tabel itu sendiri, apakah saya perlu berhati-hati saat menghapus seluruh tabel? (If I have a foreign key constraint of a table to itself, do I need to be careful when deleting the whole table?)

如何檢查我是否只刪除了所需的數據? (How do I check that I removed required data only?)

如何在 Postgres 8.2 中禁用參照完整性? (How do I disable referential integrity in Postgres 8.2?)

Xóa phụ huynh nếu nó không được tham chiếu bởi bất kỳ đứa trẻ nào khác (Delete parent if it's not referenced by any other child)

Có cách nào để kiểm tra tính toàn vẹn của tham chiếu cho các bảng MyIsam bằng cách sử dụng quan hệ gốc YII không? (Is there a way to check referential integrity for MyIsam tables using YII native relations?)

ActiveDirectoryMembershipProvider 和參照完整性 (ActiveDirectoryMembershipProvider and referential integrity)

SQL2005:將一個錶鍊接到多個表並保留Ref Integrity? (SQL2005: Linking a table to multiple tables and retaining Ref Integrity?)

違反完整性約束 - 調用存儲過程時未找到父鍵 (Integrity constraint violated - parent key not found when calling stored procedure)

db2 參照完整性問題 (db2 referential integrity problem)

無法在 Access 中強制執行參照完整性 (unable to enforce referential integrity in Access)

破壞的參照完整性:埃德加科德會說什麼? (Broken referential integrity: What would Edgar Codd say?)

如何更新鏈接到多個表的 FK - 更新時的級聯 (How to update FK linked to multiple table - Cascade on Update)







留言討論